The FlatScrollBar control is a replacement for the intrinsic HScrollBar and VScrollBar controls: You can substitute an HScrollBar or VScrollBar control with a FlatScrollBar control with the same name, and the program continues to work as before. This control can work as either a horizontal or a vertical scroll bar, according to the value of its Orientation property. This property can be also modified at run time.
You can set all the properties specific to the FlatScrollBar control at design time, as shown in Figure 11-3. This control supports three graphic styles: flat, tridimensional (similar to intrinsic scroll bar controls), and Track3D (a flat scroll bar that becomes tridimensional when the mouse passes over it, much like the scroll bars in Microsoft Encarta). You can select the graphic style at design time by setting the Appearance property to one of these values: 0-fsb3D, 1-fsbFlat, or 2fsbTrack3D.
Figure 11-3. The General tab of the Property Pages dialog box of a FlatScrollBar control.
The Arrows property lets you selectively enable one or both arrows at the ends of the bar, using the values 1-cc2LeftUp or 2-cc2RightDown; the default value 0-cc2Both enables both arrows. The Min, Max, LargeChange, SmallChange, and Value properties have the same meaning they have with HScrollBar and VScrollBar controls.
At run time, you react to users' actions on a FlatScrollBar control as you would do with a regular scroll bar; that is, by executing code in Change and Scroll events. The only property of the FlatScrollBar that you might reasonably want to modify at run time is Arrows—for example, to disable the appropriate arrow when the scroll bar has reached it minimum or maximum value. You usually do this in the Change event procedure:
Private Sub FlatScrollBar1_Change() ' This is a horizontal FlatScrollBar. If FlatScrollBar1.Value = FlatScrollBar1.Min Then FlatScrollBar1.Arrows = cc2RightDown ElseIf FlatScrollBar1.Value = FlatScrollBar1.Max Then FlatScrollBar1.Arrows = cc2LeftUp Else FlatScrollBar1.Arrows = cc2Both End If End Sub |